home *** CD-ROM | disk | FTP | other *** search
/ Enter 2010 January / ENTER_2010_01.iso / Programy / Gry / Base_Invaders_ / BaseInvadersSetup1.3.exe / {app} / Scripts / Deferred.lua < prev    next >
Encoding:
Text File  |  2007-01-25  |  2.4 KB  |  102 lines

  1. G.SetGroup( "Cam" )
  2. local Cam = G.Create( "Data/BasicCamera.xml");
  3. local pos = Vector3(50,60,50);
  4. Cam.SetPosition( pos );
  5.  
  6.  
  7. function Glare()
  8.     G.DoPostPass( "DownSample",  1, 1, 2 );
  9.     G.DoPostPass( "Threshold",  2, 2, 3 );
  10.     G.BlurBuffer( 3 , 5 );
  11.     G.DoPostPass( "FinalGlare" , 1, 3, 0 );
  12. end
  13.  
  14. function MonoChrome()
  15.     G.DoPostPass( "MonoChrome",  1, 1, 0 );
  16. end
  17.  
  18.  
  19. MCog = G.Create( "Data/ModelCog.xml" );
  20. MCog.SetPosition( Vector3(90,10,90) );
  21.  
  22. Obj = G.Create( "Data/KnotCog.xml" );
  23. Obj.SetPosition( Vector3(90, 0 , 90) );
  24.  
  25. Obj = G.Create( "Data/PlaneCog.xml" );
  26. Obj.SetPosition( Vector3(90,0,90) );
  27.  
  28. Obj = G.Create( "Data/LightCog.xml"  );
  29. Obj.SetPosition( Vector3(90, 16 , 90) );
  30.  
  31.  
  32.  
  33. numLights = 9;
  34. GLight = {}; 
  35. for y=1,numLights do 
  36.     GLight[y] = G.Create( "Data/LightCog.xml"  );
  37.     GLight[y].SetRange( 12 );
  38.     GLight[y].SetAtt( 0 , 0 , 0.08 );
  39.     GLight[y].SetColor( Color( 1, 1,  1, 1) );
  40. end
  41.  
  42. --[[
  43. for y=1,numLights do 
  44.     GLight[y] = G.Create( "Data/LightCog.xml"  );
  45.     GLight[y].SetRange( 12 );
  46.     GLight[y].SetAtt( 0 , 0 , 0.05 );
  47.     
  48.     local percent = (y-1) / ( numLights-1 );
  49.     
  50.     if( percent <= 1/3 ) then
  51.         GLight[y].SetColor( Color( math.abs(1/3 - percent) * 3, 
  52.                                      math.abs(1/3 - (percent + 1/3) ) * 3, 
  53.                                      0, 1) );
  54.     end
  55.     
  56.     if( percent <= 2/3 and percent > 1/3 ) then
  57.         GLight[y].SetColor( Color( 0, 
  58.                                     math.abs(1/3 - (percent - 1/3) ) * 3, 
  59.                                     math.abs(1/3 - (percent) ) * 3), 1 );
  60.     end
  61.  
  62.     if( percent <= 1 and percent > 2/3 ) then    
  63.         GLight[y].SetColor( Color( math.abs(1/3 - (percent - 1/3) ) * 3, 
  64.                                     0, 
  65.                                     math.abs(1/3 - (percent - 2/3) ) * 3), 1 );
  66.     end
  67. end
  68. ]]--
  69.  
  70. deferred = false;
  71.  
  72.  
  73. function LightMove()
  74.  
  75.     for y=1,numLights do     
  76.         local t = CoreTime + y * (2*3.14)/ numLights;
  77.         local tpos = Vector3( 90 + math.cos( t ) * 20 , 5  ,  90 + math.sin( t ) * 20  );
  78.         GLight[y].SetPosition(tpos);
  79.     end    
  80.     
  81.     if( G.KeyTriggered( "C" ) ) then
  82.         G.ScreenCap();
  83.     end        
  84.     
  85.     if( G.KeyTriggered( "X" ) ) then
  86.         deferred = not deferred;
  87.         G.DoDeferred( deferred );        
  88.     end            
  89.     
  90. end
  91.  
  92. GArrows = {};
  93. for y=1,5 do 
  94.     for x=1,5 do 
  95.     GArrows[x+y*10] = G.Create( "Data/ArrowTest.xml" );        
  96.     local tpos = Vector3(  x * 10 + 60, 0 ,   y * 10 + 60   );
  97.     GArrows[x+y*10].SetPosition( tpos  );
  98.     GArrows[x+y*10].SetOrientation( FromDirection( Vector3(90,0,90) -  tpos  ) );
  99.     end    
  100. end
  101.  
  102. GMain[ "LightMove" ] = LightMove;